<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：员工公司求职意向
	更新：九哥
-->





<!-----------员工公司求职意向页面---------->
<div class="stepTwo" id="IstepSevenCareerCompany">
    <div class="modelPanel">
        <div class="modelTile">求职意向</div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请选择工作地点：省、市、区（县）"
                   class="regCode" readonly id="address" onclick="getProvice()">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请输入您的职能"
                   class="regCode" id="jobModule">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请输入您的职位"
                   class="regCode" id="job">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请输入您期望的薪资"
                   class="regCode" id="salary">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请输入工作类型"
                   class="regCode" id="workType">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请输入所属行业"
                   class="regCode" id="industry">
        </div>
        <div class="bossInfoDiv">
            <input type="text" placeholder="请选择到岗日期" class="regCode"
                   readonly id="jobTime">
        </div>
        <div class="bossInfoDiv">
            <span id="tags">
                <span style="color:#888888;">个人标签</span>
            </span>
            <input type="text" placeholder="请输入个人标签" class="regCode"
                   style="width:35px;border:1px solid #cccccc;color:#0088cc;"
                   value="新增" readonly onclick="getTags()">
        </div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="companyRemark">备注：方便你的客户找到你、招聘的员工找到你、了解你、信任你，图片尽量上传完善。让客户多了解自己，容易接单成功。细节决定成败，图片清晰。</div>
    <div class="nextStepDiv">
        <span class="prevStep" onclick="history.go(-1)">上一步</span>
        <!--<span class="nextStep" id="staffComWillNext">下一步</span>-->
        <span class="nextStep" onclick="setSave()">下一步</span>
    </div>
</div>
<span id="proviceHtml"></span>
<span id="cityHtml"></span>
<span id="regionHtml"></span>
<input type="hidden" id="proviceId" value="0">
<input type="hidden" id="cityId" value="0">
<input type="hidden" id="regionId" value="0">
<input type="hidden" id="tagCount" value="0">
<input type="hidden" id="tagStr" value="">
<!-----------员工公司求职意向页面---------->






<!-----------提示信息---------->
<div id="pop">
    <div id="popMask"></div>
    <div id="popDetail">
    </div>
</div>
<!-----------提示信息---------->

<!-----------提示信息---------->
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<script type="text/javascript" src="../js/loginStaff.js"></script>
<script>
    (function(){
        getComWills(); //自动加载页面信息
    })();
    /**
     * 员工公司求职意向，获取
     * */
    function getComWills() {
        var userInfo = cacheGet('userInfo'); //获取用户信息
        var comWills = cacheGet('staffComWills'); //获取用户公司求职意向
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        //加载本地本地缓存
        if (comWills) {
            $('#address')[0].value = comWills.address;
            $('#jobModule')[0].value = comWills.jobModule;
            $('#job')[0].value = comWills.job;
            $('#salary')[0].value = comWills.salary;
            $('#workType')[0].value = comWills.workType;
            $('#industry')[0].value = comWills.industry;
            $('#jobTime')[0].value = comWills.jobTime;
            var tags,tagStr, i, tagHtml = '';
            tagStr = comWills.tags;
            tags = tagStr.split("||");
            for (i=0;i<tags.length;i++) {
                tagHtml += '<style>.tags{max-width:50px;border:1px solid #cccccc;text-align:center;}</style>';
                tagHtml += '<input type="text" class="regCode tags" readonly value="'+tags[i]+'" id="tagInput'+tags[i]+'"/>&nbsp;';
            }
            $('#tags').html(tagHtml);
        }
        //请求数据，更新本地缓存
        var data = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate
        };
        $.ajax({
            type:'post',
            url:getDomain() + 'staff/com-will',
            data:data,
            success:function(res){
                //console.log(res); return;
                if (res.code!=0) {
                    console.log(res); return;
                }
                $('#address')[0].value = res.data.address;
                $('#jobModule')[0].value = res.data.jobModule;
                $('#job')[0].value = res.data.job;
                $('#salary')[0].value = res.data.salary;
                $('#workType')[0].value = res.data.workType;
                $('#industry')[0].value = res.data.industry;
                $('#jobTime')[0].value = res.data.jobTime;
                var tags, i, tagHtml = '';
                tags = res.data.tags;
                for (i=0;i<tags.length;i++) {
                    tagHtml += '<style>.tags{max-width:50px;border:1px solid #cccccc;text-align:center;}</style>';
                    tagHtml += '<input type="text" class="regCode tags" readonly value="'+tags[i]+'" id="tagInput'+tags[i]+'"/>&nbsp;';
                }
                $('#tags').html(tagHtml);
                //更新本地缓存
                cacheSet('staffComWills',res.data);
            },
            error:function(){
                console.log('操作失败！'); return;
            }
        });
    }
    /**
     * 设置保存
     * */
    function setSave(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        var address = $('#address').val();
        var jobModule = $('#jobModule').val();
        var job = $('#job').val();
        var salary = $('#salary').val();
        var workType = $('#workType').val();
        var industry = $('#industry').val();
        var jobTime = $('#jobTime').val();
        var tagStr = $('#tagStr').val();
        //var tags = tagStr.split("||");
        var comWills = {
            address:address,
            jobModule:jobModule,
            job:job,
            salary:salary,
            workType:workType,
            industry:industry,
            jobTime:jobTime,
            tags:tagStr
        };
        var data = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate,
            comWills:comWills
        };
        //console.log(data); return;
        cacheSet('staffComWills',comWills); //员工公司求职意向
        $.ajax({
            type:'post',
            url:getDomain() + 'staff/set-com-will',
            data:data,
            success:function(res){
                //console.log(res); return;
                if (res.code!=0) {
                    getErrMsg(res.msg); return;
                }
                window.location.href = '/h5/login/staffList.html';
            },
            error:function(){
                getErrMsg('操作失败！'); return;
            }
        });
    }
    /**
     * 地址前缀
     * */
    function getDomain(){
        return '/api/member/';
    }
</script>
</html>